package net.wofly.sale.stock.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.activiti.engine.task.Comment;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wofly.flow.dto.FormPropertyDto;
import net.wofly.right.domain.Organization;
import net.wofly.right.domain.User;

/**
 * 领料申请
 *
 * @author lign
 * @version 1.0
 * @created 29-9月-2017 21:43:56
 */
@Data
@Entity
@Table(name = "sale_stock_resourceask")
@ApiModel(description = "领料申请")
public class ResourceAsk {
    
	//    @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
	//    @JoinColumn(name = "resourceAskID")
	@Transient
    @ApiModelProperty(value = "领料内容", required = true)
    public List<ResourceAskList> resourceAskLists;
    
    @Id
    private String resourceAskID;
    /**
     * 申请人
     */
    @ApiModelProperty(value = "申请人", required = true)
    private String asker;
    
    /**
     * 申请人名称
     */
    @Transient
    @ApiModelProperty(value = "申请人名称", required = true)
    private String askerName;
    
    /**
     * 申请人用户信息
     */
    @Transient
    @ApiModelProperty(value = "申请人用户信息", required = true)
    private User askerUser;
    
    
    
    /**
     * 申请时间
     */
    private Long askTime;
    /**
     * 审核人
     */
    @ApiModelProperty(value = "审核人")
    private String checker;
    /**
     * 审核时间
     */
    private Long checkTime;
    /**
     * 发货人
     */
    @ApiModelProperty(value = "发货人", required = true)
    private String consigner;
    /**
     * 发货时间
     */
    private Long consignTime;
    /**
     * 出库人
     */
    @ApiModelProperty(value = "出库人", required = true)
    private String outStocker;

    /**
     * 出库人
     */
    private Long outStockTime;
    /**
     * 单据状态
     */
    private Integer status;
    
    /**
     * 是否完成
     */
    private Integer isFinish = 0;
    
    /**
     * 单据状态说明
     */
    @Transient
    private String statusStr;
    
    /**
     * 申请编码
     * 编码规则为：日期+四位编码 如：201009080004
     */
    @ApiModelProperty(value = "申请编码")
    private String askNo;

    /**
     * 库管
     */
    @ApiModelProperty(value = "库管")
    private String stocker;
    
    @ApiModelProperty(value = "申请所在部门")
	@Transient
	private Organization organization ;
    
    @ApiModelProperty(value = "工作流定义key")
    private String processDefKey ;
    
    @ApiModelProperty(value = "工作流实例ID")
    private String processInsID ;
    
    @ApiModelProperty(value = "工作流任务ID")
    private String taskID ;
    
    @ApiModelProperty(value = "工作流任务名称")
    private String taskName ;
    
    @ApiModelProperty(value = "工作流实例审批意见")
    @Transient
	private List<Comment> comments ;
	
    @ApiModelProperty(value = "任务表单内容")
	@Transient
	private List<FormPropertyDto> formPropertyDtos ;
    
    public ResourceAsk() {
        
    }
}